﻿using System;
using System.Collections.Generic;
//using System.Linq;
using System.Web;

namespace DXL_Library
{
    [Serializable]
    public class DXL_Sheet
    {
        private int _numHoja;

        public int NumHoja
        {
            get { return _numHoja; }
            set { _numHoja = value; }
        }

        public List<DXL_Grid> Grillas;

        private string _nombre;

        public string Nombre
        {
            get { return _nombre; }
            set { _nombre = value; }
        }

        private bool _esRequerida;

        public bool EsRequerida
        {
            get { return _esRequerida; }
            set { _esRequerida = value; }
        }

        private int _idHoja;

        public int IdHoja
        {
            get { return _idHoja; }
            set { _idHoja = value; }
        }
        public override bool Equals(object obj)
        {
            bool resp ;

            resp = false ;

            if ((obj != null) && (obj is DXL_Sheet))
            {
                resp = (this.IdHoja == ((DXL_Sheet)obj).IdHoja) ;

            }
            return resp;
        }
        public override int GetHashCode()
        {
            return IdHoja;
        }

        public override string ToString()
        {
            string resp;
            string requerida;

            requerida = (this.EsRequerida) ? "Requerida" : "Opcional";
            resp = string.Format("Hoja:{0}, {1}, IdHoja:{2}\n", this.Nombre, requerida, this.IdHoja);

            if (this.Grillas != null)
            {
                foreach (DXL_Grid g in this.Grillas)
                {
                    resp += "\t" + g.ToString() + "\n";
                }

            }
            return resp;
        }




    }
}